﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using TTSIDAL;
using TTSModel;

namespace TTSDAL
{
    public class T0002028Summary : BaseRepository<T0002028SummaryInfo>, IT0002028Summary
    {
     
          #region 静态变量定义
          private const string PARM_UNITTYPE_ID = "@ID";
          private const string PARM_UNITTYPE_TCODE = "@Tcode";
          private const string PARM_UNITTYPE_TCODENAME = "@TestName";
          private const string PARM_UNITTYPE_TCODEVERSION = "@MeasurementName";
          #endregion

          #region 数据检索部分
          public IList<T0002028SummaryInfo> LoadEntities()
          {
              return null;
          }
          public IList<T0002028SummaryInfo> LoadEntities(string tcode)
          {
              SqlParameter parm = new SqlParameter(PARM_UNITTYPE_TCODE, SqlDbType.NChar, 9);
              parm.Value = tcode;
              return ExcuteSqlToGetEntities("T0002028SummaryInfo_selectbyTcode", parm);
          }

          public T0002028SummaryInfo LoadEntity<T1>(T1 id)
          {
              SqlParameter parm = GetParameter();
              parm.Value = id;
              return null;
          }

          public T0002028SummaryInfo UnitType_GetbyTcode(string tcode)
          {
              SqlParameter parm = new SqlParameter(PARM_UNITTYPE_TCODE, SqlDbType.NChar, 8);
              parm.Value = tcode;
              return null;
          }
          #endregion

          #region 重写基类方法
          public override T0002028SummaryInfo GetEntityRecord(SqlDataReader rdr)
          {
              T0002028SummaryInfo entity = new T0002028SummaryInfo()
              {
                  ID = rdr.GetInt32(0),
                  SN = rdr.GetValue(1).ToString(),
                  ExecutableVersion = rdr.GetValue(2).ToString(),
                  DatabaseVersion = rdr.GetValue(3).ToString(),
                  Status = rdr.GetValue(4).ToString(),
                  TestDuration = rdr.GetValue(5).ToString(),
                  DateTested = rdr.GetValue(6).ToString(),
                  EndTime = rdr.GetValue(7).ToString(),
                  PowerMeterCalibrationStatus = rdr.GetValue(8).ToString(),
                  TestsetCalibrationStatus = rdr.GetValue(9).ToString()                
              };
              return entity;
          }

          public override T0002028SummaryInfo GetEntityRecord()
          {
              T0002028SummaryInfo entity = new T0002028SummaryInfo();
              return null;
          }

          public override string GetInsertsp()
          {
              return null;
          }

          public override string GetUpdatesp()
          {
              return null;
          }

          public override string GetDeletesp()
          {
              return null;
          }

          public override SqlParameter GetParameter()
          {
              SqlParameter parm = new SqlParameter(PARM_UNITTYPE_ID, SqlDbType.NVarChar, 50);
              return parm;
          }

          public override SqlParameter[] GetParameters()
          {
              SqlParameter[] parms = new SqlParameter[]
            {
                new SqlParameter(PARM_UNITTYPE_ID,SqlDbType.Int,4),
                new SqlParameter(PARM_UNITTYPE_TCODE,SqlDbType.Text,16),
                new SqlParameter(PARM_UNITTYPE_TCODENAME,SqlDbType.Text,16),
                new SqlParameter(PARM_UNITTYPE_TCODEVERSION,SqlDbType.Text,16),
            };
              return parms;
          }

          public override void SetParameters(T0002028SummaryInfo Entity, params SqlParameter[] Parms)
          {
              Parms[0].Value = Entity.SN;
              Parms[1].Value = Entity.ExecutableVersion;
              Parms[2].Value = Entity.DatabaseVersion;
              Parms[3].Value = Entity.Status;
          }
          #endregion

      }
    
}
